Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a option for filtering vars to the ns-vars middleware #605

Merged
merged 1 commit into from
Mar 28, 2019

Conversation

liquidz
Copy link
Member

@liquidz liquidz commented Mar 27, 2019

Fix #566.

(u/update-keys name)
(into (sorted-map))))
(defn ns-vars-clj [ns & [include-privates?]]
(let [fetch-vars (if include-privates?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also use var-query here directly. That would simplify a bit the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reviewing!
I missed var-query API. I'll fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbatsov Fixed!

If we have orchard.query/vars for clojurescript, I think it seems better to use var-query API like test-var-query op.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have it yet (something that @arichiardi can probably tackle), but I think we can still adopt the same API and just "fake" it on the cljs side for now (by ignoring everything but the private filter).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbatsov OK! I fixed to take var-query option for filtering vars.
On the cljs side, it only support private? query currently.

@bbatsov
Copy link
Member

bbatsov commented Mar 27, 2019

The PR looks good overall. I mostly wonder if we should try to use here the var-query API, as this would give more flexibility to the ns filtering in general.

@codecov
Copy link

codecov bot commented Mar 28, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@1016f61). Click here to learn what that means.
The diff coverage is 95.12%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #605   +/-   ##
========================================
  Coverage          ?   76.5%           
========================================
  Files             ?      37           
  Lines             ?    2409           
  Branches          ?     128           
========================================
  Hits              ?    1843           
  Misses            ?     438           
  Partials          ?     128
Impacted Files Coverage Δ
src/cider/nrepl.clj 95.97% <100%> (ø)
src/cider/nrepl/middleware/ns.clj 90.9% <94.59%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1016f61...0431a95. Read the comment docs.

@liquidz liquidz changed the title Add a option for including private vars to the ns-vars middleware Add a option for filtering vars to the ns-vars middleware Mar 28, 2019
@bbatsov bbatsov merged commit e43ef3d into clojure-emacs:master Mar 28, 2019
@bbatsov
Copy link
Member

bbatsov commented Mar 28, 2019

Fantastic work! Thanks! 🙇

@arichiardi
Copy link
Contributor

A newbie question on this, what is the difference between this ns-vars middleware and the information returned by orchard/info?

The kind of seem redundant but maybe ns-vars does something different?

@bbatsov
Copy link
Member

bbatsov commented Mar 28, 2019

I was referring to https://github.com/clojure-emacs/orchard/blob/master/src/orchard/query.clj How is info related to ns-vars?

@arichiardi
Copy link
Contributor

Oh ok it is a different use case...I was just wondering if info can provide the same kind of information there. I did not even know we had such a feature 😄 Sorry for the noise here 😄

@liquidz liquidz deleted the feature/ns-vars branch March 29, 2019 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants